/**
 * GraphHelp
 */

 function GraphHelp(paper){
     this.paper = paper;
 };

 GraphHelp.prototype = {
     defaultAttr: {
        'stroke': 'none',
     },
     drawEllipse: function(cx, cy, rx, ry, color) {
         this.paper.clear();
         this.graph = this.paper.ellipse(cx, cy, rx, ry);
         this.setAttr(color);
     },
     drawRectangle: function(x, y, w, h, color) {
         this.paper.clear();
         this.graph = this.paper.rect(x, y, w, h);
         this.graph.attr('r', 10);
         this.setAttr(color);
     },
     setAttr: function(color) {
         this.graph.attr(this.defaultAttr);
         this.updateColor(color);
     },
     updatePageSize: function(w, h) {
         this.paper.setSize(w, h);
     },
     updateEllipseAttr: function(cx, cy, rx, ry) {
         this.updateAttr({
             cx: cx,
             cy: cy,
             rx: rx,
             ry: ry,
         });
     },
     updateRectangel: function(x, y, w, h) {
         this.updateAttr({
             x: x,
             y: y,
             width: w,
             height: h
         });
     },
     updateAttr: function(attr) {
         this.graph.attr(attr);
     },
     updateColor: function(color) {
         this.graph.attr('fill', '#' + color);
     },
     updateOpacity: function(opacity) {
         this.graph.attr('opacity', opacity);
     },
     updateRadius: function(radius) {
         this.graph.attr('r', radius);
     }
 };

 module.exports = GraphHelp;
